package com.xymtop.api.aop;


import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;



/**
 * @ClassName : LogAspet
 * @Description : 打印日志
 * @Author : 肖叶茂
 * @Date: 2022/12/6  12:13
 */
@Aspect
@Component
public class LogAspet {
    @Around("execution(* com.xymtop.api.controller..*(..))")
    public Object After(ProceedingJoinPoint joinPoint) throws Throwable {
        System.out.println("fun:  " + joinPoint.getSignature());
        for(Object obj :joinPoint.getArgs()){
            System.out.println("arg:"+obj.toString());
        }

        Object res = joinPoint.proceed();

        System.out.println("res: "+res.toString());

        return res;
    }
}
